package com.audaque.springboot.foshanupload.mbmul.config.db1;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @author zgb
 * @desc ...
 * @date 2022-12-04 04:38:39
 */
@Configuration
@ConditionalOnProperty(value = "switch.mbmul",havingValue = "true",matchIfMissing = false)
public class Db1SqlSessionTemplateConfig {
    @Qualifier("db1DataSource")
    @Autowired
    private DataSource db1DataSource;
    @Qualifier("db1SqlSessionFactory")
    @Autowired
    private SqlSessionFactory db1SqlSessionFactory ;

    @Bean
    public SqlSessionTemplate db1SqlSessionTemplate( ) throws Exception {
        return new SqlSessionTemplate(db1SqlSessionFactory);
    }

}
